package com.qfjy.shichengyong.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @author:scy
 * @date:2022/9/13 19:46
 * @version:1.0
 */
public class ProxyTest {

    public static void main(String[] args) {
        Person student = new Student("张三");

        InvocationHandler stuhandler = new StuInvocationHandler<Person>(student);

        Person stuProxy = (Person) Proxy.newProxyInstance(Person.class.getClassLoader(),Student.class.getInterfaces(),stuhandler);

        stuProxy.giveMoney();
    }
}
